var pageii = null;
var grid = null;
$(function() {

	grid = lyGrid({
		pagId : 'paging',
		l_column : [{
			colkey : "dates",
			name : "日期时间"
		},{
			colkey : "job_number",
			name : "工号",

		}, {
			colkey : "name",
			name : "姓名",
			
		},{
			colkey : "decision",
			name : "是否迟到",
			renderData : function(rowindex,data, rowdata, column) {
				if(data==1){ return "未迟到"}else if(data==2){return "迟到"};
			}
		}],
		jsonUrl : rootPath + '/hrchecking/checking_findByPage.shtml',
		dymCol:true,
		checkbox : true,
		serNumber : false
	});
	$("#editOrder").click("click", function() {
		editAccount();
	});
	$("#details").click("click", function() {
		particulars();
	});
	$("#search").click("click", function() {// 绑定查询按扭
		
		var searchParams = $("#searchForm").serializeJson();
		grid.setOptions({
			data : searchParams
			
		});
	});
	
});





function editAccount() {
	var cbox = grid.getSelectedCheckbox();
	if (cbox.length > 1) {
		layer.msg("只能选中一个");
		return;
	}
	if(cbox == ""){
		layer.msg("需要选择一个");
		return;
	}
	pageii = layer.open({
		title : "编辑考勤信息 ",
		type : 2,
		area : [ "800px", "100%" ],
		content : rootPath + '/hrchecking/checking_edit.shtml?id=' + cbox
	});
}

/*详情展示
 */
function particulars() {
	var cbox = grid.getSelectedCheckbox();
	if (cbox.length > 1) {
		layer.msg("只能选中一个");
		return;
	}
	if(cbox == ""){
		layer.msg("需要选择一个");
		return;
	}
	pageii = layer.open({
		title : "详情展示",
		type : 2,
		area : [ "800px", "100%" ],
		content : rootPath + '/hrchecking/checking_particulars.shtml?id=' + cbox
	});
}
